package com.zego.wawaji.ui.play.dialog;

import android.support.v4.app.FragmentActivity;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.zego.wawaji.R;
import com.noble.library.basic.string.StringUtils;
import com.zego.wawaji.ui.dialog.popup.BottomPopup;

/**
 * 首抓未中奖币弹框
 * Created by Su on 2018/3/8.
 */
public class PlayAwardDialog extends BottomPopup {
    private TextView btn_submit;
    private ImageView btn_close;
    private String failAwardTitle;
    private String failAwardContent;

    public PlayAwardDialog(FragmentActivity activity, String failAwardTitle, String failAwardContent) {
        super(activity);
        this.failAwardTitle = failAwardTitle;
        this.failAwardContent = failAwardContent;
    }

    @Override
    protected View makeContentView() {
        View inflate = LayoutInflater.from(activity).inflate(R.layout.play_award_dialog, null);
        TextView tv_title = (TextView) inflate.findViewById(R.id.tv_title);
        TextView tv_remark = (TextView) inflate.findViewById(R.id.tv_remark);
        tv_title.setText(TextUtils.isEmpty(failAwardTitle) ? "恭喜获得" : failAwardTitle);
        tv_remark.setText(TextUtils.isEmpty(failAwardContent) ?
                "萌妹送你20个币\n可以通过邀请好友获得免费娃娃币\n爪子下面有激光点 一定要对准呀！" :
                StringUtils.replaceTag(failAwardContent, "|", "\n"));

        btn_submit = (TextView) inflate.findViewById(R.id.btn_submit);
        btn_close = (ImageView) inflate.findViewById(R.id.btn_close);
        return inflate;
    }

    public void setPositiveButton(View.OnClickListener listener) {
        btn_submit.setOnClickListener(listener);
    }

    public void setNegativeButton(View.OnClickListener listener) {
        btn_close.setOnClickListener(listener);
    }

    public void setCountTimes(String msg) {
        btn_submit.setText(msg);
    }
}
